// [[ OnflowGenerator File UUID: 8440b337d9a8491b8330cb86475ef553  ]]
package com.itdct.onflow.system.api.controller

import com.itdct.onflow.core.type.*
import com.itdct.onflow.core.vo.KeyLabelValueVo
import com.itdct.onflow.core.vo.RespPageVo
import com.itdct.onflow.core.vo.RespVo
import com.itdct.onflow.system.api.qo.SysApiMenuEditQo
import com.itdct.onflow.system.api.qo.SysApiMenuSearchQo
import com.itdct.onflow.system.api.service.SysApiMenuService
import com.itdct.onflow.system.api.vo.SysApiMenuDetailVo
import com.itdct.onflow.system.api.vo.SysApiMenuListVo
import com.itdct.onflow.system.common.base.BaseSysController
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.MediaType
import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.annotation.*

/**
 * @author DCTANT
 * @date 2025-09-05 16:31:45
 * @version 1.0
 * @description 系统接口菜单关联接口控制
 */
@Tag(name = SysApiMenuController.moduleName)
@RestController
@RequestMapping(value = ["/sysApiMenu"], produces = [MediaType.APPLICATION_JSON_VALUE], method = [RequestMethod.POST])
class SysApiMenuController(
    val sysApiMenuService: SysApiMenuService
) : BaseSysController() {
    companion object {
        const val moduleName = "系统接口菜单关联"
    }

    @Operation(summary = moduleName + "添加")
    @PostMapping("/add.adw")
    fun add(@RequestBody @Validated(Add::class) qo: SysApiMenuEditQo): RespVo<Long> {
        return sysApiMenuService.add(qo, getContext())
    }

    @Operation(summary = moduleName + "更新")
    @PostMapping("/update.adw")
    fun update(@RequestBody @Validated(Update::class) qo: SysApiMenuEditQo): RespVo<Unit> {
        return sysApiMenuService.update(qo, getContext())
    }

    @Operation(summary = moduleName + "删除")
    @PostMapping("/delete.adw")
    fun delete(@RequestBody @Validated(Delete::class) qo: SysApiMenuEditQo): RespVo<Unit> {
        return sysApiMenuService.delete(qo, getContext())
    }

    @Operation(summary = moduleName + "详情")
    @PostMapping("/detail.adw")
    fun detail(@RequestBody @Validated(Detail::class) qo: SysApiMenuSearchQo): RespVo<SysApiMenuDetailVo> {
        return sysApiMenuService.detail(qo, getContext())
    }

    @Operation(summary = moduleName + "列表")
    @PostMapping("/page.adw")
    fun page(@RequestBody @Validated(Page::class) qo: SysApiMenuSearchQo): RespPageVo<SysApiMenuListVo> {
        return sysApiMenuService.page(qo, getContext())
    }

    // [[ OnflowGenerator Range (- selectFunctions -) Start ]]
    @Operation(summary = moduleName + "接口id下拉选")
    @PostMapping("/selectApiIdList.adw")
    fun selectApiIdList(@RequestBody qo: SysApiMenuSearchQo): RespVo<List<KeyLabelValueVo>> {
        return sysApiMenuService.selectApiIdList(qo, getContext())
    }

    @Operation(summary = moduleName + "菜单id下拉选")
    @PostMapping("/selectMenuIdList.adw")
    fun selectMenuIdList(@RequestBody qo: SysApiMenuSearchQo): RespVo<List<KeyLabelValueVo>> {
        return sysApiMenuService.selectMenuIdList(qo, getContext())
    }

// [[ OnflowGenerator Range (- selectFunctions -) End ]]
}